package com.struts2.example.model;

import java.sql.Connection;
import java.sql.DriverManager;

public class Connect {

	private Connection conn;

	public Connection GetConnect() {
		return conn;
	}

	public String GetString() {
		return "chao";
	}

	public Connect() {

		String url = "jdbc:mysql://localhost:3306/testonline_bang_dai?user=root&password=root&useUnicode=true&characterEncoding=utf8";
		String driver = "com.mysql.jdbc.Driver";

		try {
			Class.forName(driver).newInstance();

			conn = DriverManager.getConnection(url);

			System.out.println("Connected to the database");
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	/*
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Connect con = new Connect();

	}
	*/
	 
}
